﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebService
{
    /// <summary>
    /// WebService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        //Login
        [WebMethod(Description = "0.0登陆")]
        public string Login(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "登陆");
        }

        //Check
        [WebMethod(Description = "1.0原料到货验收")]
        public string Check(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "原料到货验收");
        }

        //putaway
        [WebMethod(Description = "2.0原料上架")]
        public string Putaway(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "原料上架");
        }

        //Print
        [WebMethod(Description = "2.1原料上架打印")]
        public string Print(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "原料上架打印");
        }

        //通过Master label获取库存
        [WebMethod(Description = "3.0获取库存")]
        public string Inventory_Sum(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "ML库存");
            //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><sku_return><userid>admin</userid><whseid>wh1</whseid><master_label>83016000300|PO0001|20160121|200|T03002</master_label><sku>83016000300</sku><label_qty>200</label_qty><qty>200</qty><return_status></return_status></sku_return></NewDataSet>";
        }

        //空箱扫描
        [WebMethod(Description = "3.1空箱扫描")]
        public string Order(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "空箱扫描叫料");
            // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><order_return><userid>admin</userid><whseid>wh1</whseid><orderkey>HO17012100002</orderkey><return_status>OK</return_status></order_return></NewDataSet>";
        }

        //通过Serial、Master Label获取ASN明细
        [WebMethod(Description = "4.0ASN明细")]
        public string Asn(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "Serial获取ASN");
            // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><asn_return><userid>admin</userid><whseid>wh1</whseid><serial>815450</serial><asn>HI17030800001</asn><sku>83016000300</sku><qty>100</qty><return_status></return_status></asn_return><asn_return><userid>admin</userid><whseid>wh1</whseid><serial>815450</serial><asn>HI17030800001</asn><sku>83016000300</sku><qty>100</qty><return_status></return_status></asn_return></NewDataSet>";
        }

        //成品上架
        [WebMethod(Description = "4.1成品上架")]
        public string Putaway_Pro(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "成品上架库位");
            // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><putaway_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><qty>100</qty><storage>RA100201</storage><return_status>OK</return_status></putaway_return><putaway_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><qty>100</qty><storage>RA100201</storage><return_status>OK</return_status></putaway_return></NewDataSet>";
        }

        //成品打印上架标签
        [WebMethod(Description = "4.2成品上架打印标签")]
        public string Print_Pro(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "成品上架打印");
            //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><print_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><batch>20160121</batch><qty>100</qty><storage>RA100201</storage><lpn>L0000001267</lpn><return_status></return_status><page>1</page></print_return><print_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><batch>20160121</batch><qty>100</qty><storage>RA100201</storage><lpn>L0000001267</lpn><return_status></return_status><page>2</page></print_return></NewDataSet>";
        }

        //原料库存查询
        [WebMethod(Description = "5.0原料库存查询")]
        public string Material_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "原料库存");
            //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><order_return><userid>admin</userid><whseid>wh1</whseid><master_label>83016000300|PO0001|20160121|200|T03002</master_label><sku>83016000300</sku><qty>100</qty><check_qty>10</check_qty><putaway_qty>20</putaway_qty><backup_qty>10</backup_qty><rejects_qty>5</rejects_qty><return_status>OK</return_status></order_return></NewDataSet>";
        }

        //成品库存查询
        [WebMethod(Description = "6.0成品库存查询")]
        public string Product_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "成品库存");
            //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><product_return><userid>admin</userid><whseid>wh1</whseid><serial>000001</serial><sku>83016000300</sku><qty>100</qty><picking_qty>10</picking_qty><rejects_qty>20</rejects_qty><return_status>OK</return_status></product_return></NewDataSet>";
        }

        //7.0.库位转移-库存明细
        [WebMethod(Description = "7.0.库存转移-库存明细查询")]
        public string Search_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "ML库存明细");
            //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><product_return><userid>admin</userid><whseid>wh1</whseid><serial>000001</serial><sku>83016000300</sku><qty>100</qty><picking_qty>10</picking_qty><rejects_qty>20</rejects_qty><return_status>OK</return_status></product_return></NewDataSet>";
        }

        //7.1.库位转移-库位转移
        [WebMethod(Description = "7.1.库位转移-库位转移")]
        public string Move_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "库位转移");
        }

        //9.0通过Serial获取出货和库存信息
        [WebMethod(Description = "9.0通过Serial获取出货和库存信息")]
        public string Search_Orders(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "SERIAL库存查询");
        }

        //9.1通过出货-分配库位
        [WebMethod(Description = "9.1通过出货-分配库位")]
        public string Allot_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "出货分配库位");
        }

        //9.2通过出货信息-分配库位--库位确认
        [WebMethod(Description = "9.2通过出货信息-分配库位--库位确认")]
        public string AllotConfirm_Inventory(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "出货拣货确认");
        }

        //委托打印
        [WebMethod(Description = "委托打印")]
        public string Delegate_Print(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "委托打印");
        }


        //10.0通过拣货信息-拣货扫描--生成托盘号
        [WebMethod(Description = "10.0通过拣货信息-拣货扫描--生成托盘号")]
        public string OrderOutScanning(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "调拨通用方法");
        }

        //11.0通过调拨单-扫描调拨单号、托盘号入库
        [WebMethod(Description = "11.0根据调拨单--扫描调拨单、托盘号入库")]
        public string AllocationReceipt(string xml)
        {
            return LicPdaService.MainHandler.MessageHandler(xml, "调拨入库通用方法");
        }

        ////10.1通过拣货信息-拣货扫描--生成托盘号
        //[WebMethod(Description = "10.1通过拣货信息-根据拣货扫描信息--打托")]
        //public string OrderPickTray (string xml)
        //{
        //    return LicPdaService.MainHandler.MessageHandler(xml, "打托");
        //}

        ////10.2 通过出库单号、托盘号、打印托盘标签
        //[WebMethod(Description = "10.2通过出库单号、托盘号、打印托盘标签")]
        //public string OrderPickTrayPrint(string xml)
        //{
        //    return LicPdaService.MainHandler.MessageHandler(xml, "打印托盘标签");
        //}





    }

}
